package com.example.project_demo.dao;

import com.example.project_demo.pojo.Emp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author 韦红材
 * @ClassName EmpMapper
 * @data 2024/12/23 09:30
 * @Version V1.0
 **/
@Mapper
public interface EmpMapper {
    //更新收入
    @Update("update emp set sal=#{sal}+sal where deptno=#{deptno}")
    int updateEmpMoney(int deptno,double sal);
    //查询emp
    @Select("select * from emp where empno=#{empno}")
    Emp secletEmpById(int empno);

    //添加
    @Insert("insert into emp ( ename, job, mgr, hiredate, sal, comm, deptno) values " +
            "(#{ename},#{job},#{mgr},#{hiredate},#{sal},#{comm},#{deptno})")
    void addEmp(Emp emp);
}
